using System;
using System.Collections.Generic;
using System.Text;

namespace org.ngwt.user.server.rpc
{
    /**
     * This is an abstract class for representing the serialization policy for a
     * given module and
     * {@link com.google.gwt.user.client.rpc.RemoteService RemoteService}.
     */
    public abstract class SerializationPolicy
    {
          /**
           * Returns <code>true</code> if the class' fields should be deserialized.
           * 
           * @param clazz the class to test
           * @return <code>true</code> if the class' fields should be deserialized
           */
          public abstract Boolean shouldDeserializeFields(Type clazz);

          /**
           * Returns <code>true</code> if the class' fields should be serialized.
           * 
           * @param clazz the class to test
           * @return <code>true</code> if the class' fields should be serialized
           */
          public abstract Boolean shouldSerializeFields(Type clazz);

          /**
           * Validates that the specified class should be deserialized from a stream.
           * 
           * @param clazz the class to validate
           * @throws SerializationException if the class is not allowed to be
           *           deserialized
           */
          public abstract void validateDeserialize(Type clazz);

          /**
           * Validates that the specified class should be serialized into a stream.
           * 
           * @param clazz the class to validate
           * @throws SerializationException if the class is not allowed to be serialized
           */
        public abstract void validateSerialize(Type clazz);
    }
}
